#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QCursor>
#include <QToolButton>



class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = 0);
    ~MainWindow();

protected:
    void mousePressEvent(QMouseEvent *event);
    void mouseMoveEvent(QMouseEvent *event);
    void mouseReleaseEvent(QMouseEvent *event);

    //void paintEvent(QPaintEvent *event);
    void enterEvent(QEvent *event);
    void leaveEvent(QEvent *event);

    void timerEvent(QTimerEvent *event);
    void resizeEvent(QResizeEvent* event);

private slots:
    void plus();
    void windowMin();
    void windowMax();
    void windowClose();

private:
    int         m_mouseCurrID = 0;
    QCursor     m_cursor;
    QPoint      m_pressPoint;
    bool        m_moveFlag   = false;
    int         m_moveHeight = 30;      //鼠标移动窗口距离top的最大距离

    QToolButton *m_plusButton;
    QToolButton *m_minButton;
    QToolButton *m_maxButton;
    QToolButton *m_closeButton;
};

#endif // MAINWINDOW_H
